package ru.susu.algebra.wrapper.number;

import java.math.BigInteger;

/**
 * @author akargapolov
 * @since: 24.03.2009
 */
public class IntegerWrapper implements INumberWrapper<Integer>
{
	private int _value;

	public IntegerWrapper(Integer value)
	{
		_value = value;
	}

	@Override
	public INumberWrapper<Integer> add(INumberWrapper<Integer> other)
	{
		return new IntegerWrapper(_value + other.getValue());
	}

	@Override
	public INumberWrapper<Integer> divide(INumberWrapper<Integer> other)
	{
		return new IntegerWrapper(_value / other.getValue());
	}

	@Override
	public Integer getValue()
	{
		return _value;
	}

	@Override
	public INumberWrapper<Integer> multiply(INumberWrapper<Integer> other)
	{
		return new IntegerWrapper(_value * other.getValue());
	}

	@Override
	public INumberWrapper<Integer> subtract(INumberWrapper<Integer> other)
	{
		return new IntegerWrapper(_value - other.getValue());
	}

	@Override
	public void setValue(Number value)
	{
		_value = value.intValue();
	}

	@Override
	public long remainder(long val)
	{
		return _value % val;
	}

	@Override
	public INumberWrapper<Integer> mod(BigInteger mod) throws Exception
	{
		throw new RuntimeException();
	}

}
